# -*- codeing = utf-8 -*-
# @Time : 2021/2/28 10:18
# @Atuthor: 朱朱
# @File: 151装饰器回顾.py
# @Software: PyCharm

def can_play(fn): # fn 被装饰的函数
    print('外部函数被调用了....')

    def inner(name,game,**kwargs):
        """
        开始前,fn(),开始后
        :param name:
        :param game:
        :param kwargs:
        :return:
        """
        clock = kwargs.get('clock',21)
        if clock>21:
            print('太晚了不能玩游戏了')
        else:
            fn(name,game)
    return inner # 将装饰的结果返回

@can_play
def play_geme(name,game):
    print(name+'正在玩'+game)

play_geme('jack','hero',clock =20)